home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-02-20 | 23.1 KB | 1,010 lines |
- Newsgroups: comp.sources.misc
- organization: Maple Lawn Farm, Stonington, CT
- subject: v10i081: tek - yet another tek4014 emulator
- from: ron@mlfarm.uucp (Ronald Florence)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 10, Issue 81
- Submitted-by: ron@mlfarm.uucp (Ronald Florence)
- Archive-name: tek
-
- Tek is yet another tek4014 emulator. This one produces output through
- the SCO CGI drivers. The code is written so that by modifying a
- single header file, the output can instead by created for other
- devices. A sample header file for the Hewlett-Packard HP7470a plotter
- is included.
- __________________________________________________________________
- #! /bin/sh
- # This is a shell archive, meaning:
- # 1. Remove everything above the #! /bin/sh line.
- # 2. Save the resulting text in a file.
- # 3. Execute the file with /bin/sh (not csh) to create:
- # Readme
- # Makefile
- # tek.c
- # tekdecode.c
- # tek4.h
- # poly.c
- # tekpts.c
- # hp7470-tek4.h
- # tek.man
- # This archive created: Mon Feb 19 08:02:50 1990
- # By: Ronald Florence (Maple Lawn Farm, Stonington, CT)
- export PATH; PATH=/bin:/usr/bin:$PATH
- echo shar: "extracting 'Readme'" '(1739 characters)'
- if test -f 'Readme'
- then
- echo shar: "will not over-write existing file 'Readme'"
- else
- sed 's/^X//' << \SHAR_EOF > 'Readme'
- X tek - yet another tek4014 emulator
- X copyright 1990 Ronald Florence
- X
- X This package creates yet another tek4014 emulator. On a
- X Xenix system with the CGI package, the Makefile will create
- X tek and poly (actually a link). Tek reads tek4014 input and
- X outputs it to any CGI device. Poly reads ascii integer or
- X floating point xy points. Using the SCO CGI devices, we
- X have successfully used tek and poly with a VGA, EGA, and CGA
- X display, HP 7470a plotter, Laserjet, Deskjet, Epson
- X printers, and a Postscript printer. To use the CGI drivers,
- X make sure you have the CGIPATH and CGIDISP or CGIPRNT
- X environmental variables declared. Tek and poly also
- X recognize and work correctly with a Wyse wy99gt terminal
- X
- X Command line options:
- X Invoked as "tek":
- X -w reads Accu-Weather maps
- X Invoked as "poly":
- X -s read xmin, ymin, xmax, ymax scaling points first
- X (default is 4096 x 3120)
- X Both:
- X -p use plotter or printer device for output
- X (default is to use the display device)
- X -a preserve aspect ratio
- X
- X The heart of the code is tekdecode.c, which has been written
- X so that simple changes to tek4.h will adapt the emulator to
- X devices other than CGI. A tek4.h header file for the
- X Hewlett-Packard HP7470a plotter is included as a sample.
- X Tekdecode.c has also been successfully adapted to drive an
- X Epson printer directly.
- X
- X Permission is hereby granted for unlimited non-commercial
- X use of these programs, on condition that the copyright
- X notices are left intact and any modifications to the source
- X code are noted as such. No warranty of any kind is implied
- X or granted for this material.
- X
- X Ronald Florence
- X Maple Lawn Farm, Stonington, CT
- X ron@mlfarm.uu.net
- X {yale,uunet}!hsi!mlfarm!ron
- SHAR_EOF
- if test 1739 -ne "`wc -c < 'Readme'`"
- then
- echo shar: "error transmitting 'Readme'" '(should have been 1739 characters)'
- fi
- fi
- echo shar: "extracting 'Makefile'" '(447 characters)'
- if test -f 'Makefile'
- then
- echo shar: "will not over-write existing file 'Makefile'"
- else
- sed 's/^X//' << \SHAR_EOF > 'Makefile'
- X# tek makefile
- X# copyright 1990 Ronald Florence
- X
- XCFLAGS= -O
- XLDFLAGS= -lccgi -s
- XINSTALL_DIR = /u/bin
- XMAN_DIR = /usr/man/man.LOCAL
- X
- Xpoly: tek
- X ln tek poly
- X
- Xtek: tek.o tekdecode.o poly.o tekpts.o
- X cc tek.o tekdecode.o poly.o tekpts.o $(LDFLAGS) -o tek
- X
- Xtekdecode.o: tek4.h
- X
- Xinstall: tek
- X cp tek $(INSTALL_DIR)
- X ln $(INSTALL_DIR)/tek $(INSTALL_DIR)/poly
- X cp tek.man $(MAN_DIR)/tek
- X ln $(MAN_DIR)/tek $(MAN_DIR)/poly
- X rm -f tek poly
- X
- Xclean:
- X rm -f *.o
- SHAR_EOF
- if test 447 -ne "`wc -c < 'Makefile'`"
- then
- echo shar: "error transmitting 'Makefile'" '(should have been 447 characters)'
- fi
- fi
- echo shar: "extracting 'tek.c'" '(4298 characters)'
- if test -f 'tek.c'
- then
- echo shar: "will not over-write existing file 'tek.c'"
- else
- sed 's/^X//' << \SHAR_EOF > 'tek.c'
- X/*
- X * tek.c
- X * copyright 1988 Ronald Florence
- X *
- X * as "tek" - Tek4014 picture files to CGI or WY99
- X * -w Accu-Weather maps
- X * as "poly" - reads points for polyline on CGI or WY99
- X * -s read xmin, ymin, xmax, ymax scaling points first
- X * (default is 4096 x 3120)
- X * both:
- X * -p use plotter or printer (default display)
- X * -a preserve aspect ratio
- X *
- X * bugs: SIGINT doesn't work with wy99 modes. Possible solution is to
- X * poll terminal on every iteration, with terminal set in raw mode.
- X */
- X
- X#include <signal.h>
- X#include <stdio.h>
- X#include <termio.h>
- X#include <fcntl.h>
- X
- X#define int short /* for CGI functions */
- X#define CRT (wout[45] == 0)
- X#define To_tek "\033[?38h"
- X#define To_vt220 "\033[?38l"
- X#define Clr_tek "\033\f"
- X#define Vt_reset "\033!p"
- X
- Xint dev; /* device id */
- Xstatic int tty;
- Xstruct termio new, old;
- Xstatic int tek; /* =1 if invoked as tek */
- Xstatic char *progn;
- Xstatic char *dspec[] = {"CGIDISP", "CGIPRNT", 0 };
- X
- Xmain (argc, argv)
- X int argc;
- X char **argv;
- X{
- X FILE *fi = stdin;
- X int win[19], /* device input info */
- X wout[66], /* device output info */
- X h = 0,
- X aspect = 0, /* map to max CGI space */
- X opt = 0,
- X sig_handle(), quit_wyse();
- X char *device, *p, *getenv(), *strrchr();
- X
- X progn = (p = strrchr(*argv, '/')) ? p + 1 : *argv;
- X tek = strcmp(progn, "poly");
- X if (strlen(getenv("ASPECT")))
- X aspect = 3;
- X
- X while (argc-- && **++argv == '-')
- X for (p = *argv+1; *p; p++)
- X switch (*p)
- X {
- X case 'w' :
- X if (tek)
- X ++opt;
- X else
- X usage();
- X break;
- X case 's' :
- X if (!tek)
- X ++opt;
- X else
- X usage();
- X break;
- X case 'p' :
- X ++h;
- X break;
- X case 'a' :
- X aspect = 3;
- X break;
- X default :
- X usage();
- X }
- X /* we cannot do freopen(stdin) for the */
- X /* input because the CGI functions */
- X /* read from stdin */
- X if (argc > 0 && (fi = fopen(*argv, "r")) == NULL)
- X {
- X printf("%s: can't open %s\n", progn, *argv);
- X exit (-1);
- X }
- X /* open /dev/tty to read keystrokes */
- X tty = open("/dev/tty", O_RDWR);
- X ioctl(tty, TCGETA, &new);
- X ioctl(tty, TCGETA, &old);
- X /* wyse 99 terminal? */
- X if (!h && !strncmp(getenv("TERM"), "wy99", 4))
- X {
- X /* not this easy, alas ... */
- X signal(SIGINT, quit_wyse);
- X printf("%s%s", To_tek, Clr_tek);
- X if (tek)
- X vt_tek(fi, opt);
- X else
- X tekpts(fi, opt);
- X fflush(stdout);
- X getkey();
- X quit_wyse();
- X }
- X /* check for valid CGI device */
- X for ( ; (device = dspec[h]) && getenv(dspec[h]) == NULL; h++) ;
- X if (!device)
- X {
- X printf("%s: no device\n", progn);
- X exit (-1);
- X }
- X signal( SIGHUP, sig_handle );
- X signal( SIGINT, sig_handle );
- X signal( SIGQUIT, SIG_IGN );
- X
- X win[0] = aspect;
- X win[1] = 1; /* solid line */
- X win[2] = 1; /* line color */
- X win[3] = 1; /* marker type . */
- X win[4] = 1; /* marker color */
- X win[5] = 1; /* graphics text font */
- X win[6] = 1; /* graphics text color */
- X win[7] = 0; /* fill interior style */
- X win[8] = 0; /* fill style index */
- X win[9] = 1; /* fill color index */
- X win[10] = 1; /* prompt for paper changes */
- X for (h = 0; device[h]; h++)
- X win[11+h] = device[h];
- X win[18] = ' ';
- X
- X if (v_opnwk(win, &dev, wout) < 0)
- X {
- X printf("%s: error %d opening %s\n", progn, -vq_error(), device);
- X exit (-1);
- X }
- X if (tek)
- X tekdecode(fi, opt);
- X else
- X do_poly(fi, opt);
- X if (CRT)
- X getkey();
- X v_clswk(dev);
- X}
- X
- X
- Xusage ()
- X{
- X printf("usage: %s file\n", tek ? "tek [-wpa]" : "poly [-spa]");
- X exit (-1);
- X}
- X
- X
- Xerr (func)
- X char func[];
- X{
- X int errnum;
- X
- X errnum = strcmp(func, "data") ? -(vq_error()) : 0;
- X v_clswk(dev);
- X if (errnum)
- X printf ("%s: error no. %d in CGI function %s\n", progn, errnum, func);
- X else
- X printf (tek ? "tek: too many data points\n" : "poly: invalid scaling points\n");
- X exit (-2);
- X}
- X
- X
- Xint sig_handle (sig)
- X int sig;
- X{
- X v_clswk( dev );
- X exit( sig );
- X}
- X
- Xgetkey()
- X{
- X char c;
- X
- X new.c_lflag &= ~(ECHO|ICANON);
- X new.c_cc[VMIN] = 1;
- X ioctl(tty, TCSETAW, &new);
- X read(tty, &c, 1);
- X ioctl(tty, TCSETA, &old);
- X}
- X
- Xint quit_wyse () /* needs all of it to restore wy99 */
- X{
- X fflush (stdout);
- X fprintf (stderr, "%s%s", Clr_tek, To_vt220);
- X sleep (1);
- X fprintf (stderr, "%s", Vt_reset);
- X exit (0);
- X}
- X
- SHAR_EOF
- if test 4298 -ne "`wc -c < 'tek.c'`"
- then
- echo shar: "error transmitting 'tek.c'" '(should have been 4298 characters)'
- fi
- fi
- echo shar: "extracting 'tekdecode.c'" '(4503 characters)'
- if test -f 'tekdecode.c'
- then
- echo shar: "will not over-write existing file 'tekdecode.c'"
- else
- sed 's/^X//' << \SHAR_EOF > 'tekdecode.c'
- X/*
- X * tekdecode.c - converts Tek4014 picture files
- X * copyright 1988 Ronald Florence
- X *
- X * decoding algorithm from J. Tenenbaum (2/24/87)
- X * alpha mode (2/21/88)
- X * linetypes (5/12/88)
- X * increment mode (5/23/88)
- X * corrected algorithm (6/30/88)
- X */
- X
- X#include <stdio.h>
- X#include "tek4.h"
- X
- X#define US 0x1f
- X#define RS 0x1e
- X#define GS 0x1d
- X#define FS 0x1c
- X#define ESC 0x1b
- X#define BS 0x8
- X#define HT 0x9
- X#define LF 0xa
- X#define VT 0xb
- X
- X#define NONE 0
- X#define VECTOR 1
- X#define POINT 2
- X#define ALPHA 3
- X#define INCREMENT 4
- X
- X#define Low_Y 0x2
- X#define CTRL 0
- X#define HI 1
- X#define LOX 2
- X#define LOY 3
- X
- Xstatic int charht[4] = { 36, 40, 61, 66 },
- X charwd[4] = { 24, 26, 40, 44 },
- X#ifdef WEATHER
- X weather,
- X#endif
- X cellw, /* current width of a character cell */
- X chsize = 3; /* font */
- X
- X
- Xtekdecode (infile, opt)
- X FILE *infile;
- X int opt;
- X{
- X register c, mode;
- X int pts[Maxpts * 2], pn, got = 0, escape = 0, hisave,
- X tx, ty, lox, loy, hix, hiy, devx, devy;
- X char gstring[256], *g;
- X
- X mode = NONE;
- X Align(Left, Base);
- X Set_charsize(chsize);
- X while ((c = getc(infile)) != EOF)
- X {
- X c &= 0x7f;
- X if (escape)
- X {
- X parse(c);
- X escape = 0;
- X continue;
- X }
- X if (c >> 5 == CTRL)
- X {
- X if (c == '\0') /* they pad, we strip */
- X continue;
- X if (mode == ALPHA)
- X {
- X *g = '\0';
- X if (g > gstring)
- X Wr_str(devx, devy, gstring);
- X devx += (g - gstring) * cellw;
- X mode = NONE;
- X }
- X if (mode == INCREMENT)
- X {
- X tx *= xm;
- X ty *= ym;
- X Increment(tx, ty);
- X }
- X if (mode == VECTOR && pn)
- X Vector(pn, pts);
- X if (mode == POINT && pn)
- X Marker(pn, pts);
- X
- X switch (c)
- X {
- X case BS: /* cursor motions */
- X case HT: /* we'll do nothing */
- X case VT:
- X break;
- X case GS:
- X mode = VECTOR;
- X pn = 0;
- X break;
- X case FS:
- X mode = POINT;
- X pn = 0;
- X break;
- X case US:
- X g = gstring;
- X mode = ALPHA;
- X break;
- X case ESC :
- X ++escape;
- X break;
- X case RS :
- X mode = INCREMENT;
- X tx = 0;
- X ty = 0;
- X break;
- X case LF: /* clear bypass */
- X mode = NONE;
- X break;
- X }
- X continue;
- X }
- X /* else not a control char */
- X#ifdef WEATHER
- X if (opt && weather)
- X {
- X weather = 0;
- X if (c == 'P') /* bailout at "PRESS" */
- X return;
- X if (c == 'c' && chsize == 0) /* tiny "c" for (c) */
- X Switch_pen();
- X }
- X#endif
- X switch (mode)
- X {
- X case NONE:
- X continue;
- X case VECTOR:
- X case POINT :
- X switch (c >> 5)
- X {
- X case HI:
- X hisave = c & ~0x20;
- X got |= HI;
- X break;
- X case LOY:
- X loy = c & ~0x60;
- X got |= Low_Y;
- X if (got & HI)
- X {
- X hiy = hisave;
- X got &= ~HI;
- X }
- X break;
- X case LOX:
- X lox = c & ~0x40;
- X if (got & HI)
- X {
- X if (got & Low_Y)
- X hix = hisave;
- X else
- X hiy = hisave;
- X }
- X got &= ~(HI | Low_Y);
- X /* process the coordinates */
- X tx = ((hix << 5) + lox) << 2;
- X ty = ((hiy << 5) + loy) << 2;
- X devx = tx * xm + xscale;
- X devy = ty * ym + yscale;
- X pts[pn++] = devx;
- X pts[pn++] = devy;
- X if (pn > Maxpts * 2)
- X err("data");
- X break;
- X }
- X break;
- X case ALPHA:
- X *g++ = c;
- X break;
- X case INCREMENT:
- X switch (c)
- X {
- X case ' ':
- X break;
- X case 'D': /* north */
- X ++ty;
- X break;
- X case 'H': /* south */
- X --ty;
- X break;
- X case 'A': /* east */
- X ++tx;
- X break;
- X case 'B': /* west */
- X --tx;
- X break;
- X case 'E': /* northeast */
- X ++ty;
- X ++tx;
- X break;
- X case 'J': /* southwest */
- X --ty;
- X --tx;
- X break;
- X }
- X break;
- X }
- X }
- X}
- X
- X
- Xparse(inch)
- X int inch;
- X{
- X int ltype = NONE;
- X
- X switch (inch)
- X {
- X case '\f':
- X Clear_scr();
- X break;
- X case '`' :
- X case 'e' :
- X case 'f' :
- X case 'g' :
- X case 'h' :
- X case 'm' :
- X case 'n' :
- X case 'o' :
- X ltype = Solid;
- X break;
- X case 'a' :
- X case 'i' :
- X ltype = Dotted;
- X break;
- X case 'b' :
- X case 'j' :
- X ltype = Dotdash;
- X break;
- X case 'c' :
- X case 'k' :
- X ltype = Shortdash;
- X break;
- X case 'd' :
- X case 'l' :
- X ltype = Longdash;
- X break;
- X case '8' :
- X case '9' :
- X case ':' :
- X case ';' :
- X Set_charsize (chsize = ';' - inch);
- X#ifdef WEATHER
- X ++weather;
- X#endif
- X break;
- X }
- X if (ltype > 0)
- X Set_line(ltype);
- X}
- SHAR_EOF
- if test 4503 -ne "`wc -c < 'tekdecode.c'`"
- then
- echo shar: "error transmitting 'tekdecode.c'" '(should have been 4503 characters)'
- fi
- fi
- echo shar: "extracting 'tek4.h'" '(1219 characters)'
- if test -f 'tek4.h'
- then
- echo shar: "will not over-write existing file 'tek4.h'"
- else
- sed 's/^X//' << \SHAR_EOF > 'tek4.h'
- X/*
- X * tek4.h - CGI version
- X * copyright 1988 Ronald Florence
- X */
- X
- X#define WEATHER 1
- X#define Maxpts 1000
- X#define int short /* for CGI functions */
- X#define Tekx 4096.0
- X#define Teky 3120.0
- X#define Vmax 31000 /* Tek programs cheat! */
- X#define Hmax 32000
- X
- Xdouble xm = Hmax / Tekx,
- X ym = Vmax / Teky,
- X xscale = (32768 - Hmax) / 2.0,
- X yscale;
- X
- X#define Left 0 /* character alignment */
- X#define Base 0
- X#define Solid 1 /* linetypes */
- X#define Longdash 2
- X#define Dotted 3
- X#define Dotdash 4
- X#define Shortdash 7
- X#define Altcolor 2 /* red */
- X
- X
- Xextern int dev; /* device handle */
- X
- X#define Align(H, V) { \
- X int gh, gv; \
- X vst_alignment(dev, Left, Base, &gh, &gv); \
- X }
- X#define Clear_scr() /* v_clrwk(dev) */
- X#define Set_line(L) vsl_type(dev, L)
- X#define Increment(X,Y)
- X#define Switch_pen() { \
- X vst_color(dev, Altcolor); \
- X vsl_color(dev, Altcolor); \
- X vsm_color(dev, Altcolor); \
- X }
- X
- X#define Set_charsize(s) { \
- X int chh, chw, cellh; \
- X chh = charht[s] * ym; \
- X vst_height(dev, chh, &chw, &cellw, &cellh); \
- X }
- X#define Vector(N, PTS) v_pline(dev, (N/2), PTS)
- X#define Marker(N, PTS) v_pmarker(dev, (N/2), PTS)
- X#define Wr_str(X, Y, p) v_gtext(dev, X, Y, p)
- SHAR_EOF
- if test 1219 -ne "`wc -c < 'tek4.h'`"
- then
- echo shar: "error transmitting 'tek4.h'" '(should have been 1219 characters)'
- fi
- fi
- echo shar: "extracting 'poly.c'" '(1452 characters)'
- if test -f 'poly.c'
- then
- echo shar: "will not over-write existing file 'poly.c'"
- else
- sed 's/^X//' << \SHAR_EOF > 'poly.c'
- X/*
- X * poly.c
- X * copyright 1988 Ronald Florence
- X */
- X
- X#include <stdio.h>
- X
- X#define int short /* for CGI functions */
- X#define Maxpts 1000
- X#define Vdimax 32000
- X#define Tekx 4096.0
- X#define Teky 3120.0
- X
- Xextern int dev; /* device id */
- X
- Xstatic double xscale = Vdimax / Tekx,
- X yscale = Vdimax / Teky;
- X
- X
- Xdo_poly (infile, scaled)
- X FILE *infile;
- X int scaled;
- X{
- X double ix, iy, txlo, txhi, tylo, tyhi;
- X int ptc = 0, pts [Maxpts], xadd = 0, yadd = 0;
- X
- X if (scaled) {
- X /* read and check the scaling points */
- X if ( fscanf(infile, "%lf%lf%lf%lf", &txlo, &tylo, &txhi, &tyhi ) == EOF
- X || txlo >= txhi
- X || tylo >= tyhi )
- X err ("data");
- X /* rescale */
- X xscale = Vdimax / (txhi - txlo);
- X yscale = Vdimax / (tyhi - tylo);
- X xadd = -txlo * xscale;
- X yadd = -tylo * yscale;
- X }
- X /* read one xy point at a time */
- X while ( fscanf(infile, "%lf%lf", &ix, &iy) != EOF ) {
- X /* put them out when we have Maxpts / 2 */
- X if ( ptc >= Maxpts ) {
- X if (v_pline (dev, (ptc / 2), pts) < 0 )
- X err ("v_pline");
- X /* copy the last points to the first */
- X pts [0] = pts [ptc -2];
- X pts [1] = pts [ptc -1];
- X /* and set counter to start over */
- X ptc = 2;
- X }
- X /* scale the points for the array */
- X pts [ptc++] = ix * xscale + xadd;
- X pts [ptc++] = iy * yscale + yadd;
- X }
- X /* make sure we get the tail end */
- X if ( ptc > 2 && v_pline (dev, (ptc / 2), pts) < 0 )
- X err ("v_pline");
- X}
- SHAR_EOF
- if test 1452 -ne "`wc -c < 'poly.c'`"
- then
- echo shar: "error transmitting 'poly.c'" '(should have been 1452 characters)'
- fi
- fi
- echo shar: "extracting 'tekpts.c'" '(1952 characters)'
- if test -f 'tekpts.c'
- then
- echo shar: "will not over-write existing file 'tekpts.c'"
- else
- sed 's/^X//' << \SHAR_EOF > 'tekpts.c'
- X/*
- X * tekpts.c
- X * copyright 1988 Ronald Florence
- X */
- X
- X#include <stdio.h>
- X
- X#define Tekx 4096.0
- X#define Teky 3120.0
- X
- Xvt_tek (infile, weather)
- X FILE *infile;
- X int weather;
- X{
- X register c, escape = 0;
- X
- X while ((c = getc(infile)) != EOF)
- X {
- X if (weather)
- X switch (escape)
- X {
- X case 0 :
- X if (c == 0x1b) /* escape */
- X escape = 1;
- X break;
- X case 1 :
- X escape = (c >= '8' && c <= ';') ? 2 : 0;
- X break;
- X case 2 :
- X if (c == 'P')
- X return;
- X escape = 0;
- X break;
- X }
- X putchar(c);
- X }
- X }
- X
- X
- Xtekpts (infile, scaled)
- X FILE *infile;
- X int scaled;
- X{
- X register tx, ty;
- X double xscale = 1.0, yscale = 1.0, ix, iy, sxlo, sxhi, sylo, syhi;
- X int xadd = 0, yadd = 0;
- X
- X if (scaled)
- X {
- X /* read and check the scaling points */
- X if ( fscanf(infile, "%lf%lf%lf%lf", &sxlo, &sylo, &sxhi, &syhi ) == EOF
- X || sxlo >= sxhi
- X || sylo >= syhi )
- X err ("data");
- X /* rescale */
- X xscale = Tekx / (sxhi - sxlo);
- X yscale = Teky / (syhi - sylo);
- X xadd = -sxlo * xscale;
- X yadd = -sylo * yscale;
- X }
- X
- X putchar(0x1d); /* tek vector mode */
- X while ( fscanf(infile, "%lf%lf", &ix, &iy) != EOF )
- X {
- X tx = ix * xscale + xadd;
- X ty = iy * yscale + yadd;
- X /* clip */
- X if (tx >= Tekx)
- X tx = Tekx - 1;
- X if (tx < 0)
- X tx = 0;
- X if (ty >= Teky)
- X ty = Teky -1;
- X if (ty < 0)
- X ty = 0;
- X /* The fancy way is to send hiy, */
- X /* loy, and hix only when they change. */
- X /* This works. We shift the high */
- X /* part by 7 instead of 5 and shift */
- X /* the low part by 2 because we scale */
- X /* the Tek at 4096 x 3120 */
- X putchar(0x20 | ((ty >> 7) & 0x1f)); /* hi y */
- X putchar(0x60 | ((ty >> 2) & 0x1f)); /* low y */
- X putchar(0x20 | ((tx >> 7) & 0x1f)); /* hi x */
- X putchar(0x40 | ((tx >> 2) & 0x1f)); /* low x */
- X }
- X putchar(0x1f); /* end tek vector mode */
- X}
- X
- SHAR_EOF
- if test 1952 -ne "`wc -c < 'tekpts.c'`"
- then
- echo shar: "error transmitting 'tekpts.c'" '(should have been 1952 characters)'
- fi
- fi
- echo shar: "extracting 'hp7470-tek4.h'" '(1479 characters)'
- if test -f 'hp7470-tek4.h'
- then
- echo shar: "will not over-write existing file 'hp7470-tek4.h'"
- else
- sed 's/^X//' << \SHAR_EOF > 'hp7470-tek4.h'
- X/*
- X * tek4.h - hp7470a version
- X * copyright 1987 Ronald Florence
- X */
- X
- X#define WEATHER 1
- X#define Maxpts 1000
- X
- X#define Points 0
- X#define Solid 1
- X#define Longdash 2
- X#define Dotted 3
- X#define Dotdash 4
- X#define Shortdash 5
- X#define Altcolor 2
- X
- Xextern FILE *plw; /* plotter write file */
- Xextern int quit(); /* baleout function */
- Xextern double xm, /* scalars */
- X ym,
- X xscale,
- X yscale;
- X
- X
- Xchar *linetype[] = {
- X "LT0", /* Points */
- X "LT", /* Solid */
- X "LT3", /* Longdash */
- X "LT1,1", /* Dotted */
- X "LT4", /* Dotdash */
- X "LT2" /* Shortdash */
- X };
- X
- X
- X#define Clear_scr()
- X#define Align(H, V)
- X#define Set_line(L) fprintf(plw, "%s", linetype[L])
- X#define Increment(X,Y) fprintf(plw, "PU%d,%d", X, Y)
- X#define Wr_str(X, Y, p) fprintf(plw, "LB%s\03", p)
- X#define Switch_pen() fprintf(plw, "SP%d", Altcolor)
- X
- X#define Set_charsize(s) cellw = charwd[s] * xm * (3 / 2); \
- X fprintf(plw, "SI%.3f,%.3f", \
- X charwd[s] * xm /400, charht[s] * ym /400)
- X
- X#define Vector(N, PTS) plot(N, PTS)
- X
- X#define Marker(N, PTS) { \
- X Set_line (Points); \
- X plot (N, PTS); \
- X Set_line (Solid); \
- X }
- X
- X#define err(a) if (!strcmp(a, "data")) \
- X fprintf(stderr, "hp: too many data points\n"), quit()
- X
- X
- Xplot (num, points)
- X int num, points[];
- X{
- X register i;
- X
- X fprintf(plw, "PU%d,%d", points[0], points[1]);
- X if (num > 2)
- X {
- X fprintf(plw, "PD");
- X for (i = 2; i < num - 1; i++)
- X fprintf(plw, "%d,", points[i]);
- X fprintf(plw, "%d", points[i]);
- X }
- X}
- SHAR_EOF
- if test 1479 -ne "`wc -c < 'hp7470-tek4.h'`"
- then
- echo shar: "error transmitting 'hp7470-tek4.h'" '(should have been 1479 characters)'
- fi
- fi
- echo shar: "extracting 'tek.man'" '(1550 characters)'
- if test -f 'tek.man'
- then
- echo shar: "will not over-write existing file 'tek.man'"
- else
- sed 's/^X//' << \SHAR_EOF > 'tek.man'
- X.TH TEK LOCAL
- X.SH NAME
- Xtek \- Tektronics 4010/14 post-processor
- X.br
- Xpoly \- displays polygon from XY points
- X.SH SYNOPSIS
- X.B tek
- X[
- X.I -wap
- X] [
- X.I file
- X]
- X.br
- X.B poly
- X[
- X.I -sap
- X] [
- X.I file
- X]
- X.SH DESCRIPTION
- X.PP
- XThe
- X.I tek
- Xfilter displays files formatted for the Tektronics 4010/14 terminal on
- Xa CGI device or on the Wyse 99\s-2GT\s0 terminal. The
- X.I -w
- Xoption parses an Accu-Weather map for multi-color output devices.
- X.PP
- X.I Poly
- Xdraws a polygon from a list of XY points in ascii integer or floating
- Xpoint format on a CGI device or on the Wyse 99\s-2GT\s0 terminal. The
- Xpoints are expected to be scaled to the Tectronics (4096 \(mu 3120)
- Xscreen unless the
- X.I -s
- Xoption is used to specify that the first two sets of points represent
- X.SM XMIN,
- X.SM YMIN
- Xand
- X.SM XMAX,
- X.SM YMAX.
- X.PP
- XThe
- X.I -p
- Xoption may be used with both
- X.I tek
- Xand
- X.I poly
- Xto select the hardcopy CGI output device specified by the
- X.SM CGIPRNT
- Xenvironment variable when a device specified by the
- X.SM CGIDISP
- Xenvironment variable or the
- X.SM WY99
- Xterminal is the default output device.
- X.PP
- XThe
- X.I -a
- Xoption specifies a square aspect ratio instead of the maximum space
- Xavailable on the CGI output device. The square aspect ratio can also
- Xbe specified by declaring a (non-null)
- X.SM ASPECT
- Xenvironment variable.
- X.SH BUGS
- XThe available type sizes on CGI output devices may not match the
- XTektronics display. The interactive Tektronics input functions are
- Xnot supported.
- X.SH AUTHOR
- XRonald Florence (ron@mlfarm). The Tektronics decoding algorithm was
- Xsuggested by Joel Tenenbaum.
- SHAR_EOF
- if test 1550 -ne "`wc -c < 'tek.man'`"
- then
- echo shar: "error transmitting 'tek.man'" '(should have been 1550 characters)'
- fi
- fi
- exit 0
- # End of shell archive
- --
-
- Ronald Florence ron@mlfarm.uu.net
- {yale,uunet}!hsi!mlfarm!ron
-
-
-